﻿#ifndef PROTOCOL_H
#define PROTOCOL_H

#include <QObject>
class   protocol_def
{
public:
    QString head;
    QString length;
    QString content;
    QString crc32;
    QString tail;
    protocol_def& operator=(const protocol_def& s)
    {
        this->head = s.head;
        this->length = s.length;
        this->content=s.content;//是否加粗
        this->crc32=s.crc32;//是否斜体
        this->tail=s.tail;//是否删除线
        return *this;
    }
    bool operator==(const protocol_def& s)
    {
        if(this->head == s.head &&
            this->length == s.length&&
            this->content==s.content&&
            this->crc32==s.crc32&&
            this->tail==s.tail)
            return true;
        return false;
    }
};

class protocol : public QObject
{
    Q_OBJECT
public:
    explicit protocol(QObject *parent = nullptr);
    ~protocol();
    QByteArray packet(QByteArray array);
    protocol_def unpacket(QByteArray array);
    bool isValid(protocol_def *def);
signals:

};

#endif // PROTOCOL_H
